home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 152 / tedinfol.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-06-21  |  2.6 KB  |  68 lines

  1. #include <aesbind.h>
  2. #include <obdefs.h>
  3. #include <gemdefs.h>
  4. #define SPEC 0x510f1L
  5. #define B1FLAGS  0x5
  6. #define B2FLAGS  0x7
  7.  
  8. char input[] = "@@@@@@@@@@";
  9. char template[] = "Your Name:________________";
  10. char check[] = "FFFFFFFFFF";
  11. char button1[] = "Ok";
  12. char button2[] = "GEM";
  13.  
  14. TEDINFO text[] = {
  15. /* text pointer(@ for none)
  16. *  |       template pointer
  17. *  |       |        validate pointer
  18. *  |       |        |     font code character
  19. *  |       |        |     |   any int
  20. *  |       |        |     |   |     justification code character
  21. *  |       |        |     |   |     |       color code
  22. *  |       |        |     |   |     |       |    any int
  23. *  |       |        |     |   |     |       |    |  border thickness(rasters)
  24. *  |       |        |     |   |     |       |    |  |   input string(char)
  25. *  |       |        |     |   |     |       |    |  |   |   template str(char)
  26. *  v       v        v     v   v     v       v    v  v   v   v               */
  27.  input, template, check, IBM, 1, TE_CNTR, WHITE, 5, 1, 11, 22
  28. };
  29.  
  30. OBJECT dialogue[] = {                     /* set up for hirez screen */
  31. /*next/head/tail/   type/   flags/   state/    spec./  X/  Y/  W/  H */
  32.     -1,  1,  3,    G_BOX,    NONE,  NORMAL,    SPEC,   0,  0,300,125,
  33.      2, -1, -1,  G_FTEXT,EDITABLE,  NORMAL,    text, 100, 50,200, 50,
  34.      3, -1, -1, G_BUTTON, B1FLAGS,  NORMAL, button1, 115,100, 20, 10,
  35.      0, -1, -1, G_BUTTON, B2FLAGS,  NORMAL, button2, 150,100, 20, 10
  36. };
  37. Rect tempbox  = { 0, 0, 0, 0 };
  38. Prect tempptr = { &tempbox.x, &tempbox.y, &tempbox.w, &tempbox.h };
  39. main()
  40. {
  41.         int nowhere = 0;
  42.         int quit;
  43.         char newstring[29] = "Your name is ";
  44.         appl_init();
  45.         graf_mouse(ARROW, &nowhere);
  46.         form_center(dialogue, tempptr);
  47.         form_dial(0, 1, 1, 1, 1, tempbox);
  48.         form_dial(1, 1, 1, 1, 1, tempbox);
  49.         objc_draw(dialogue, ROOT, MAX_DEPTH, tempbox);
  50.         for(;;)
  51.         {
  52.                 quit = form_do(dialogue, 1);
  53.                 if (quit == 2)
  54.                 {
  55.                         strcat(newstring, input);
  56.                         strcpy(template, newstring);
  57.                         objc_draw(dialogue, ROOT, MAX_DEPTH, tempbox);
  58.                 }
  59.                 if (quit == 3 )
  60.                 {
  61.                         form_dial(2, 1, 1, 1, 1, tempbox);
  62.                         form_dial(3, 1, 1, 1, 1, tempbox);
  63.                         appl_exit();
  64.                         exit(0);
  65.                 }
  66.         }     /* typed in as stated in MWC ; not yet exactly usable */
  67. }                              /* MWC pp. 361-362 6Jun'87 CJPurcell */
  68.